var buttonNormal : Texture2D;
var buttonHover : Texture2D;
var buttonClick : Texture2D;

var appleCount : GameObject;
var mainCamera : GameObject;

private var appleScript : ApplesCount;
private var clickScript : ClickScript;

function Start (){
	appleScript = appleCount.gameObject.GetComponent("ApplesCount");
	clickScript = mainCamera.gameObject.GetComponent("ClickScript");
}



function OnMouseEnter()
{
	renderer.material.mainTexture = buttonHover;
	
}

function OnMouseExit()
{
	renderer.material.mainTexture = buttonNormal;
}

function OnMouseDown()
{
	renderer.material.mainTexture = buttonClick;
}

function OnMouseUp()
{	
	if (appleScript.appleCount > 0){
		appleScript.Decrease();
		clickScript.DecreaseTotal();
	}
}